/*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * RSgeneraldefs.h
 *
 *  Created on: 2010/02/15
 *      Author: Alexandre Pires ( c.alexandre.pires@gmail.com )
 */

#ifndef RSGENERALDEFS_H_
#define RSGENERALDEFS_H_

#define RS_Cast                                 qobject_cast
#define RS_Const_Cast                           qobject_cast

#define RS_NAMESPACE                            Realsphere
#define RS_BEGIN_NAMESPACE                      namespace RS_NAMESPACE {
#define RS_END_NAMESPACE                        }
#define RS_USE_NAMESPACE                        using namespace RS_NAMESPACE;

#define RS_ARRAY_ELEMENT_CLASS                  "Realsphere::RSArrayElement"
#define RS_ARRAY_ELEMENT_TAG                    "array_element"
#define RSArrayElementCast(o)                   RS_Cast<Realsphere::RSArrayElement*>(o)
#define RSConstArrayElementCast(o)              RS_Cast<const Realsphere::RSArrayElement*>(o)

#define RS_BOOL_ARRAY_CLASS                     "Realsphere::RSBoolArray"
#define RS_BOOL_ARRAY_TAG                       "bool_array"
#define RSBoolArrayCast(o)                      RS_Cast<Realsphere::RSBoolArray*>(o)
#define RSConstBoolArrayCast(o)                 RS_Cast<const Realsphere::RSBoolArray*>(o)

#define RS_FLOAT_ARRAY_CLASS                    "Realsphere::RSFloatArray"
#define RS_FLOAT_ARRAY_TAG                      "float_array"
#define RSFloatArrayCast(o)                     RS_Cast<Realsphere::RSFloatArray*>(o)
#define RSConstFloatArrayCast(o)                RS_Cast<const Realsphere::RSFloatArray*>(o)

#define RS_INT_ARRAY_CLASS                      "Realsphere::RSIntArray"
#define RS_INT_ARRAY_TAG                        "int_array"
#define RSIntArrayCast(o)                       RS_Cast<Realsphere::RSIntArray*>(o)
#define RSConstIntArrayCast(o)                  RS_Cast<const Realsphere::RSIntArray*>(o)

#define RS_VALUE_ELEMENT_CLASS                  "Realsphere::RSValueElement"
#define RS_VALUE_ELEMENT_TAG                    "value_element"
#define RSValueElementCast(o)                   RS_Cast<Realsphere::RSValueElement*>(o)
#define RSConstValueElementCast(o)              RS_Cast<const Realsphere::RSValueElement*>(o)

#define RS_BOOL_CLASS                           "Realsphere::RSBool"
#define RS_BOOL_TAG                             "bool"
#define RSBoolCast(o)                           RS_Cast<Realsphere::RSBool*>(o)
#define RSConstBoolCast(o)                      RS_Cast<const Realsphere::RSBool*>(o)

#define RS_FLOAT_CLASS                          "Realsphere::RSFloat"
#define RS_FLOAT_TAG                            "float"
#define RSFloatCast(o)                          RS_Cast<Realsphere::RSFloat*>(o)
#define RSConstFloatCast(o)                     RS_Cast<const Realsphere::RSFloat*>(o)

#define RS_INT_CLASS                            "Realsphere::RSInt"
#define RS_INT_TAG                              "int"
#define RSIntCast(o)                            RS_Cast<Realsphere::RSInt*>(o)
#define RSConstIntCast(o)                       RS_Cast<const Realsphere::RSInt*>(o)

#define RS_NAME_CLASS                           "Realsphere::RSName"
#define RS_NAME_TAG                             "name"
#define RSNameCast(o)                           RS_Cast<Realsphere::RSName*>(o)
#define RSConstNameCast(o)                      RS_Cast<const Realsphere::RSName*>(o)










#define RS_NAME_ARRAY_TAG                       "Name_array"
#define RS_IDREF_ARRAY_TAG                      "IDREF_array"
#define RS_SIDREF_ARRAY_TAG                     "SIDREF_array"
#define RS_TOKEN_ARRAY_TAG                      "token_array"


#define RS_OBJECT_CLASS                         "Realsphere::RSObject"
#define RS_RENDERER_CLASS                       "Realsphere::RSRenderer"
#define RS_DOCUMENT_CLASS                       "Realsphere::RSDocument"
#define RS_ELEMENT_CLASS                        "Realsphere::RSElement"
#define RS_UID_ELEMENT_CLASS                    "Realsphere::RSUIDElement"
#define RS_INPUT_CLASS                          "Realsphere::RSInput"
#define RS_GEOMETRIES_LIBRARY_CLASS             "Realsphere::RSGeometriesLibrary"
#define RS_GEOMETRY_CLASS                       "Realsphere::RSGeometry"
#define RS_GEOMETRIC_ELEMENT_CLASS              "Realsphere::RSGeometricElement"
#define RS_PRIMITIVES_ELEMENT_CLASS             "Realsphere::RSPrimitivesElement"
#define RS_SERIALIZER_CLASS                     "Realsphere::RSSerializer"
#define RS_VERTICES_CLASS                       "Realsphere::RSVertices"
#define RS_DATA_SOURCE_CLASS                    "Realsphere::RSDataSource"
#define RS_LINES_CLASS                          "Realsphere::RSLines"
#define RS_LINESTRIPS_CLASS                     "Realsphere::RSLineStrips"
#define RS_POLYGONS_CLASS                       "Realsphere::RSPolygons"
#define RS_POLYLIST_CLASS                       "Realsphere::RSPolyList"
#define RS_TRIANGLES_CLASS                      "Realsphere::RSTriangles"
#define RS_TRIFANS_CLASS                        "Realsphere::RSTriFans"
#define RS_TRISTRIPS_CLASS                      "Realsphere::RSTriStrips"
#define RS_CONVEX_MESH_CLASS                    "Realsphere::RSConvexMesh"
#define RS_MESH_CLASS                           "Realsphere::RSMesh"
#define RS_SPLINE_CLASS                         "Realsphere::RSSpline"
#define RS_BREP_CLASS                           "Realsphere::RSBrep"
#define RS_SOURCE_CLASS                         "Realsphere::RSSource"
#define RS_PRIMITIVE_INDICES_CLASS              "Realsphere::RSPrimitiveIndices"
#define RS_SCENE_CLASS                          "Realsphere::RSScene"
#define RS_NODE_BASE_CLASS                      "Realsphere::RSNodeBase"
#define RS_NODE_CLASS                           "Realsphere::RSNode"
#define RS_JOINT_CLASS                          "Realsphere::RSJoint"
#define RS_LOOK_AT_CLASS                        "Realsphere::RSLookAt"
#define RS_MATRIX_CLASS                         "Realsphere::RSMatrix"
#define RS_ROTATE_CLASS                         "Realsphere::RSRotate"
#define RS_SCALE_CLASS                          "Realsphere::RSScale"
#define RS_SKEW_CLASS                           "Realsphere::RSSkew"
#define RS_TRANSLATE_CLASS                      "Realsphere::RSTranslate"
#define RS_TRANSFORMATION_ELEMENT_CLASS         "Realsphere::RSTransformationElement"
#define RS_VISUAL_SCENE_CLASS                   "Realsphere::RSVisualScene"
#define RS_VISUAL_SCENES_LIBRARY_CLASS          "Realsphere::RSVisualScenesLibrary"
#define RS_CAMERA_CLASS                         "Realsphere::RSCamera"
#define RS_OPTICS_CLASS                         "Realsphere::RSOptics"
#define RS_CAMERAS_LIBRARY_CLASS                "Realsphere::RSCamerasLibrary"
#define RS_IMAGER_CLASS                         "Realsphere::RSImager"
#define RS_TECHNIQUE_COMMON_CLASS               "Realsphere::RSTechniqueCommon"
#define RS_TECHNIQUE_CLASS                      "Realsphere::RSTechnique"
#define RS_TECHNIQUE_ELEMENT_CLASS              "Realsphere::RSTechniqueElement"
#define RS_PROJECTION_TECHNIQUE_CLASS           "Realsphere::RSProjectionTechnique"
#define RS_PROJECTION_TECHNIQUE_ELEMENT_CLASS   "Realsphere::RSProjectionTechniqueElement"
#define RS_ORTHOGRAPHIC_CLASS                   "Realsphere::RSOrthographic"
#define RS_PERSPECTIVE_CLASS                    "Realsphere::RSPerspective"
#define RS_OPENGL_RENDERER_CLASS                "Realsphere::RSOpenGLRenderer"
#define RS_BUFFER_MANAGER_CLASS                 "Realsphere::RSBufferManager"
#define RS_INSTANCE_CLASS                       "Realsphere::RSInstance"
#define RS_ANIMATION_INSTANCE_CLASS             "Realsphere::RSAnimationInstance"
#define RS_CAMERA_INSTANCE_CLASS                "Realsphere::RSCameraInstance"
#define RS_CONTROLLER_INSTANCE_CLASS            "Realsphere::RSControllerInstance"
#define RS_FORMULA_INSTANCE_CLASS               "Realsphere::RSFormulaInstance"
#define RS_GEOMETRY_INSTANCE_CLASS              "Realsphere::RSGeometryInstance"
#define RS_LIGHT_INSTANCE_CLASS                 "Realsphere::RSLightInstance"
#define RS_NODE_INSTANCE_CLASS                  "Realsphere::RSNodeInstance"
#define RS_VISUAL_SCENE_INSTANCE_CLASS          "Realsphere::RSVisualSceneInstance"
#define RS_ACCESSOR_CLASS                       "Realsphere::RSAccessor"
#define RS_PARAM_CLASS                          "Realsphere::RSParam"

#define RS_ELEMENT_TAG                          "ELEMENT"
#define RS_COLLADA_TAG                          "COLLADA"
#define RS_COLLADA_XMLNS                        "http://www.collada.org/2008/03/COLLADASchema"
#define RS_GEOMETRIES_LIBRARY_TAG               "library_geometries"
#define RS_GEOMETRY_TAG                         "geometry"
#define RS_SOURCE_TAG                           "source"
#define RS_VERTICES_TAG                         "vertices"
#define RS_INPUT_TAG                            "input"
#define RS_LINES_TAG                            "lines"
#define RS_LINESTRIPS_TAG                       "linestrips"
#define RS_POLYGONS_TAG                         "polygons"
#define RS_POLYLIST_TAG                         "polylist"
#define RS_TRIANGLES_TAG                        "triangles"
#define RS_TRIFANS_TAG                          "trifans"
#define RS_TRISTRIPS_TAG                        "tristrips"
#define RS_CONVEX_MESH_TAG                      "convex_mesh"
#define RS_MESH_TAG                             "mesh"
#define RS_SPLINE_TAG                           "spline"
#define RS_BREP_TAG                             "brep"
#define RS_PRIMITIVE_INDICES_TAG                "p"
#define RS_SCENE_TAG                            "scene"
#define RS_NODE_TAG                             "node"
#define RS_LOOK_AT_TAG                          "lookat"
#define RS_MATRIX_TAG                           "matrix"
#define RS_ROTATE_TAG                           "rotate"
#define RS_SCALE_TAG                            "scale"
#define RS_SKEW_TAG                             "skew"
#define RS_TRANSLATE_TAG                        "translate"
#define RS_VISUAL_SCENE_TAG                     "visual_scene"
#define RS_VISUAL_SCENES_LIBRARY_TAG            "library_visual_scenes"
#define RS_CAMERA_TAG                           "camera"
#define RS_OPTICS_TAG                           "optics"
#define RS_IMAGER_TAG                           "imager"
#define RS_CAMERAS_LIBRARY_TAG                  "library_cameras"
#define RS_TECHNIQUE_COMMON_TAG                 "technique_common"
#define RS_PROJECTION_TECHNIQUE_TAG             RS_TECHNIQUE_COMMON_TAG
#define RS_TECHNIQUE_TAG                        "technique"
#define RS_ORTHOGRAPHIC_TAG                     "orthographic"
#define RS_PERSPECTIVE_TAG                      "perspective"
#define RS_HORIZONTAL_MAGNIFICATION_TAG         "xmag"
#define RS_VERTICAL_MAGNIFICATION_TAG           "ymag"
#define RS_ASPECT_RATIO_TAG                     "aspect_ratio"
#define RS_ZNEAR_TAG                            "znear"
#define RS_ZFAR_TAG                             "zfar"
#define RS_HORIZONTAL_FIELD_OF_VIEW_TAG         "xfov"
#define RS_VERTICAL_FIELD_OF_VIEW_TAG           "yfov"
#define RS_ANIMATION_INSTANCE_TAG               "instance_animation"
#define RS_CAMERA_INSTANCE_TAG                  "instance_camera"
#define RS_CONTROLLER_INSTANCE_TAG              "instance_controller"
#define RS_FORMULA_INSTANCE_TAG                 "instance_formula"
#define RS_GEOMETRY_INSTANCE_TAG                "instance_geometry"
#define RS_LIGHT_INSTANCE_TAG                   "instance_light"
#define RS_NODE_INSTANCE_TAG                    "instance_node"
#define RS_VISUAL_SCENE_INSTANCE_TAG            "instance_visual_scene"
#define RS_ACCESSOR_TAG                         "accessor"
#define RS_PARAM_TAG                            "param"

#define RS_SEMANTIC_BINORMAL_VALUE              "BINORMAL"
#define RS_SEMANTIC_COLOR_VALUE                 "COLOR"
#define RS_SEMANTIC_CONTINUITY_VALUE            "CONTINUITY"
#define RS_SEMANTIC_IMAGE_VALUE                 "IMAGE"
#define RS_SEMANTIC_INPUT_VALUE                 "INPUT"
#define RS_SEMANTIC_IN_TANGENT_VALUE            "IN_TANGENT"
#define RS_SEMANTIC_INTERPOLATION_VALUE         "INTERPOLATION"
#define RS_SEMANTIC_INV_BIND_MATRIX_VALUE       "INV_BIND_MATRIX"
#define RS_SEMANTIC_JOINT_VALUE                 "JOINT"
#define RS_SEMANTIC_LINEAR_STEPS_VALUE          "LINEAR_STEPS"
#define RS_SEMANTIC_MORPH_TARGET_VALUE          "MORPH_TARGET"
#define RS_SEMANTIC_MORPH_WEIGHT_VALUE          "MORPH_WEIGHT"
#define RS_SEMANTIC_NORMAL_VALUE                "NORMAL"
#define RS_SEMANTIC_OUTPUT_VALUE                "OUTPUT"
#define RS_SEMANTIC_OUT_TANGENT_VALUE           "OUT_TANGENT"
#define RS_SEMANTIC_POSITION_VALUE              "POSITION"
#define RS_SEMANTIC_TANGENT_VALUE               "TANGENT"
#define RS_SEMANTIC_TEXBINORMAL_VALUE           "TEXBINORMAL"
#define RS_SEMANTIC_TEXCOORD_VALUE              "TEXCOORD"
#define RS_SEMANTIC_TEXTANGENT_VALUE            "TEXTANGENT"
#define RS_SEMANTIC_UV_VALUE                    "UV"
#define RS_SEMANTIC_VERTEX_VALUE                "VERTEX"
#define RS_SEMANTIC_WEIGHT_VALUE                "WEIGHT"

#define RS_NODE_TYPE_VALUE                      "NODE"
#define RS_JOINT_TYPE_VALUE                     "JOINT"

#define RS_EPSILON                              2.220446049250313E-16d
#define RS_ZERO_TOLERANCE                       0.0001f
#define RS_ONE_THIRD                            1.0/3.0
#define RS_PI                                   3.14159265358979323846
#define RS_TWO_PI                               2.0 * RS_PI
#define RS_HALF_PI                              0.5 * RS_PI
#define RS_QUARTER_PI                           0.25 * RS_PI
#define RS_INV_PI                               1.0 / RS_PI
#define RS_INV_TWO_PI                           1.0 / RS_TWO_PI
#define RS_DEG_TO_RAD                           RS_PI / 180.0
#define RS_RAD_TO_DEG                           180.0 / RS_PI

#define RS_X_AXIS                               QVector3D( 1,0,0 )
#define RS_Y_AXIS                               QVector3D( 0,1,0 )
#define RS_Z_AXIS                               QVector3D( 0,0,1 )

#define RS_DEFAULT_RIGHT                        1.0
#define RS_DEFAULT_TOP                          1.0
#define RS_DEFAULT_LEFT                         -RS_DEFAULT_RIGHT
#define RS_DEFAULT_BOTTOM                       -RS_DEFAULT_TOP
#define RS_DEFAULT_Z_NEAR                       1.0f
#define RS_DEFAULT_Z_FAR                        100.0f

#define RS_4_3_STANDARD                         4.0/3.0
#define RS_16_9_STANDARD                        16.0/9.0

#define RSObjectCast(o)                         RS_Cast<Realsphere::RSObject*>(o)
#define RSRendererCast(o)                       RS_Cast<Realsphere::RSRenderer*>(o)
#define RSDocumentCast(o)                       RS_Cast<Realsphere::RSDocument*>(o)
#define RSElementCast(o)                        RS_Cast<Realsphere::RSElement*>(o)
#define RSUidElementCast(o)                     RS_Cast<Realsphere::RSUIDElement*>(o)
#define RSInputCast(o)                          RS_Cast<Realsphere::RSInput*>(o)
#define RSGeometriesLibraryCast(o)              RS_Cast<Realsphere::RSGeometriesLibrary*>(o)
#define RSGeometryCast(o)                       RS_Cast<Realsphere::RSGeometry*>(o)
#define RSGeometricElementCast(o)               RS_Cast<Realsphere::RSGeometricElement*>(o)
#define RSPrimitivesElementCast(o)              RS_Cast<Realsphere::RSPrimitivesElement*>(o)
#define RSSerializerCast(o)                     RS_Cast<Realsphere::RSSerializer*>(o)
#define RSVerticesCast(o)                       RS_Cast<Realsphere::RSVertices*>(o)
#define RSDataSourceCast(o)                     RS_Cast<Realsphere::RSDataSource*>(o)
#define RSLinesCast(o)                          RS_Cast<Realsphere::RSLines*>(o)
#define RSLinestripsCast(o)                     RS_Cast<Realsphere::RSLineStrips*>(o)
#define RSPolygonsCast(o)                       RS_Cast<Realsphere::RSPolygons*>(o)
#define RSPolylistCast(o)                       RS_Cast<Realsphere::RSPolyList*>(o)
#define RSTrianglesCast(o)                      RS_Cast<Realsphere::RSTriangles*>(o)
#define RSTrifansCast(o)                        RS_Cast<Realsphere::RSTriFans*>(o)
#define RSTristripsCast(o)                      RS_Cast<Realsphere::RSTriStrips*>(o)
#define RSConvexMeshCast(o)                     RS_Cast<Realsphere::RSConvexMesh*>(o)
#define RSMeshCast(o)                           RS_Cast<Realsphere::RSMesh*>(o)
#define RSSplineCast(o)                         RS_Cast<Realsphere::RSSpline*>(o)
#define RSBrepCast(o)                           RS_Cast<Realsphere::RSBrep*>(o)
#define RSSourceCast(o)                         RS_Cast<Realsphere::RSSource*>(o)
#define RSPrimitiveIndicesCast(o)               RS_Cast<Realsphere::RSPrimitiveIndices*>(o)
#define RSSceneCast(o)                          RS_Cast<Realsphere::RSScene*>(o)
#define RSNodeBaseCast(o)                       RS_Cast<Realsphere::RSNodeBase*>(o)
#define RSNodeCast(o)                           RS_Cast<Realsphere::RSNode*>(o)
#define RSJointCast(o)                          RS_Cast<Realsphere::RSJoint*>(o)
#define RSLookAtCast(o)                         RS_Cast<Realsphere::RSLookAt*>(o)
#define RSMatrixCast(o)                         RS_Cast<Realsphere::RSMatrix*>(o)
#define RSRotateCast(o)                         RS_Cast<Realsphere::RSRotate*>(o)
#define RSScaleCast(o)                          RS_Cast<Realsphere::RSScale*>(o)
#define RSSkewCast(o)                           RS_Cast<Realsphere::RSSkew*>(o)
#define RSTranslateCast(o)                      RS_Cast<Realsphere::RSTranslate*>(o)
#define RSTransformationElementCast(o)          RS_Cast<Realsphere::RSTransformationElement*>(o)
#define RSVisualSceneCast(o)                    RS_Cast<Realsphere::RSVisualScene*>(o)
#define RSVisualScenesLibraryCast(o)            RS_Cast<Realsphere::RSVisualScenesLibrary*>(o)
#define RSCameraCast(o)                         RS_Cast<Realsphere::RSCamera*>(o)
#define RSOpticsCast(o)                         RS_Cast<Realsphere::RSOptics*>(o)
#define RSCamerasLibraryCast(o)                 RS_Cast<Realsphere::RSCamerasLibrary*>(o)
#define RSImagerCast(o)                         RS_Cast<Realsphere::RSImager*>(o)
#define RSTechniqueCommonCast(o)                RS_Cast<Realsphere::RSTechniqueCommon*>(o)
#define RSTechniqueCast(o)                      RS_Cast<Realsphere::RSTechnique*>(o)
#define RSTechniqueElementCast(o)               RS_Cast<Realsphere::RSTechniqueElement*>(o)
#define RSOrthographicCast(o)                   RS_Cast<Realsphere::RSOrthographic*>(o)
#define RSPerspectiveCast(o)                    RS_Cast<Realsphere::RSPerspective*>(o)
#define RSProjectionTechniqueCast(o)            RS_Cast<Realsphere::RSProjectionTechnique*>(o)
#define RSProjectionElementTechniqueCast(o)     RS_Cast<Realsphere::RSProjectionTechniqueElement*>(o)
#define RSAnimationInstanceCast(o)              RS_Cast<Realsphere::RSAnimationInstance*>(o)
#define RSCameraInstanceCast(o)                 RS_Cast<Realsphere::RSCameraInstance*>(o)
#define RSControllerInstanceCast(o)             RS_Cast<Realsphere::RSControllerInstance*>(o)
#define RSFormulaInstanceCast(o)                RS_Cast<Realsphere::RSFormulaInstance*>(o)
#define RSGeometryInstanceCast(o)               RS_Cast<Realsphere::RSGeometryInstance*>(o)
#define RSLightInstanceCast(o)                  RS_Cast<Realsphere::RSLightInstance*>(o)
#define RSNodeInstanceCast(o)                   RS_Cast<Realsphere::RSNodeInstance*>(o)
#define RSVisualSceneInstanceCast(o)            RS_Cast<Realsphere::RSVisualSceneInstance*>(o)
#define RSAccessorCast(o)                       RS_Cast<Realsphere::RSAccessor*>(o)
#define RSParamCast(o)                          RS_Cast<Realsphere::RSParam*>(o)

#endif /* RSGENERALDEFS_H_ */
